﻿//============================================================
// 自动生成的代码
// 模块名:      RequestLog 模型类
// 版本:        1.0   
// 生成时间:    2023/11/14 18:08:00
// 说明：为全自动产生，包含表名前缀
//============================================================
 

namespace Models
{
    /// <summary>
    /// RequestLog 模型类
    /// </summary>
    [Serializable()]
    public partial class RequestLogModel
    {
        #region 私有变量

        /// <summary>
        /// 保存值有变化的属性名
        /// </summary>
        private List<string> _changeProperty = null;

        //对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        private bool _isInitOK = false;

        //主键   
        private long? _ID;

        // 访问地址
        private string _URL = String.Empty;
        // 访问信息
        private string _RequestBody = String.Empty;
        // 创建时间
        private DateTime? _CreateTime = DateTime.MinValue;
        // 访问IP地址
        private string _ClientIP = String.Empty;
        // 返回状态
        private int? _StateCode = 0;
        // 返回结果使用时间
        private long? _UseTime = 0;
        // 访问端Token
        private string _TokenID = String.Empty;
        // 返回结果信息
        private string _ResponseBody = String.Empty;

        #endregion

        #region 公共属性

        /// <summary>
        /// 对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        /// </summary> 
        public bool IsInitOK
        {
            get
            {
                return _isInitOK;
            }
            set
            {
                _isInitOK = value;
                if (value && _changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
            }
        }

        /// <summary>
        /// 记录修改内容的属性名
        /// </summary> 
        public List<string> ChangeProperty
        {
            get { return this._changeProperty; }
            set
            {
                if (this._changeProperty != value)
                {
                    this._changeProperty = value;
                }
            }
        }

        /// <summary>
        /// 主键  
        /// </summary> 
        public long? ID
        {
            get { return this._ID; }
            set
            {
                if (this._ID != value)
                {
                    this._ID = value;
                    OnChanged("ID");
                }
            }
        }

        /// <summary>
        /// 访问地址
        /// </summary> 
        public string URL
        {
            get { return this._URL; }
            set
            {
                if (this._URL != value)
                {
                    this._URL = value;
                    OnChanged("URL");
                }
            }
        }

        /// <summary>
        /// 访问信息
        /// </summary>
        public string RequestBody
        {
            get { return this._RequestBody; }
            set
            {
                if (this._RequestBody != value)
                {
                    this._RequestBody = value;
                    OnChanged("RequestBody");
                }
            }
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime
        {
            get { return this._CreateTime; }
            set
            {
                if (this._CreateTime != value)
                {
                    this._CreateTime = value;
                    OnChanged("CreateTime");
                }
            }
        }

        /// <summary>
        /// 访问IP地址
        /// </summary>
        public string ClientIP
        {
            get { return this._ClientIP; }
            set
            {
                if (this._ClientIP != value)
                {
                    this._ClientIP = value;
                    OnChanged("ClientIP");
                }
            }
        }

        /// <summary>
        /// 返回状态
        /// </summary>
        public int? StateCode
        {
            get { return this._StateCode; }
            set
            {
                if (this._StateCode != value)
                {
                    this._StateCode = value;
                    OnChanged("StateCode");
                }
            }
        }

        /// <summary>
        /// 返回结果使用时间
        /// </summary>
        public long? UseTime
        {
            get { return this._UseTime; }
            set
            {
                if (this._UseTime != value)
                {
                    this._UseTime = value;
                    OnChanged("UseTime");
                }
            }
        }

        /// <summary>
        /// 访问端Token
        /// </summary>
        public string TokenID
        {
            get { return this._TokenID; }
            set
            {
                if (this._TokenID != value)
                {
                    this._TokenID = value;
                    OnChanged("TokenID");
                }
            }
        }

        /// <summary>
        /// 返回结果信息
        /// </summary>
        public string ResponseBody
        {
            get { return this._ResponseBody; }
            set
            {
                if (this._ResponseBody != value)
                {
                    this._ResponseBody = value;
                    OnChanged("ResponseBody");
                }
            }
        }


        #endregion

        #region 方法

        /// <summary>
        /// 修改属性值事件，记录值变化的属性名
        /// </summary>
        /// <param name="propertyName">属性名</param>
        private void OnChanged(string propertyName)
        {
            if (IsInitOK)
            {
                if (_changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
                if (_changeProperty.IndexOf(propertyName) < 0)
                {
                    _changeProperty.Add(propertyName);
                }
            }
        }

        #endregion
    }
}